// import the fs module to operate the files
const fs = require('fs');

/**
 * 
 * fs.readFile(path[, options], callback) usage: read the specific file's contents
 *      1. path: filename or file descriptor
 *      2. options: 
 *          a. encoding: the encoding means to read the file contents 
 *          b. flag: file system flags
 *          c. signal: allow aborting an in-progress readFile
 *      3. callback
 *          a. err: not null, if the file reading happens exception; null otherwise.
 *          b. data: the contents of the file if err is null, otherwise undifined.
 */
fs.readFile("../resources/helloword.txt", "utf-8", (err, data) => {
    if(err) throw err;

    // print the file content in the console
    console.log(data);
});

/**
 * Execute the node <filename>.js at the current file path in the command line.
 * 
 * Oh! Node make the JavaScript like a Java --- a cross-platform programming language. 
 */